{% import "TopxiaWebBundle::macro.html.twig" as web_macro %}
<tr id="student-{{ user.id }}-tr">
  <td class="media" style="vertical-align: middle;">
    {{ web_macro.user_avatar(user, 'pull-left', 'avatar-sm') }}
    <a target="_blank" href="{{ path('user_show', {id:user.id}) }}">{{ user.nickname }}</a>
    {% if student.remark %}
      <span class="text-muted text-sm" title="{{student.remark}}">({{ student.remark|plain_text(16) }})</span>
    {% endif %}
    <div class="text-muted text-sm">{{'加入时间：%createdTime%'|trans({'%createdTime%': student.createdTime|date('Y-n-d H:i') })}}</div>
    {% if course.expiryDay > 0 and student.deadline > 0 %}
      <div class="text-muted text-sm">{{'有效期至：%deadline%'|trans({'%deadline%': student.deadline|date('Y-n-d H:i') })}} ({{ student.deadline|remain_time }})</div>
    {% endif %}
  </td>

  <td style="vertical-align: middle;">
    <div class="progress mvm" title="{{'已学%number%课时'|trans({'%number%': progress.number })}}">
      <div class="progress-bar" style="width: {{ progress.percent }}">
      </div>
    </div>
  </td>

  <td style="vertical-align: middle;">
    <div class="btn-group">
      {% if app.user.id != user.id %}
        <button class="btn btn-default btn-sm" data-toggle="modal" data-target="#modal" data-url="{{path('message_create', {toId:user.id})}}">{{'发私信'|trans}}</button>
      {% endif %}
      {% if app.user.isAdmin() %}
        <button class="btn btn-default btn-sm" data-toggle="modal" data-target="#modal" data-url="{{path('course_manage_students_show', {courseId:course.id, userId:user.id})}}">{{'查看资料'|trans}}</button>
      {% elseif setting("course.buy_fill_userinfo") %}
        <button class="btn btn-default btn-sm" data-toggle="modal" data-target="#modal" data-url="{{path('course_manage_students_defined_show', {courseId:course.id, userId:user.id}) }}">{{'查看资料'|trans}}</button>
      {% endif %}
      <a href="#" type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">{{'管理'|trans}}
        <span class="caret"></span>
      </a>
      <ul class="dropdown-menu pull-right">
        <li><a class="" href="" data-toggle="modal" data-target="#modal" data-url="{{path('course_manage_student_remark', {courseId:course.id, userId:user.id})}}">{{'备注'|trans}}</a></li>
        {% if app.user.id != user.id %}
          <li>
            <a class="follow-student-btn" href="javascript:;" data-url="{{ path('user_follow', {id:user.id}) }}" {% if isFollowing %} style="display:none;"{% endif %}>{{'关注'|trans}}</a>
              <a class="unfollow-student-btn" href="javascript:;" data-url="{{ path('user_unfollow', {id:user.id}) }}" {% if not isFollowing %} style="display:none;"{% endif %}>{{'已关注'|trans}}</a>
          </li>
        {% endif %}
        {% if app.user.isAdmin() or  app.user.isTeacher() and  isTeacherAuthManageStudent == 1 and course.expiryDay > 0 %}
          <li><a class="" href="" data-toggle="modal" data-target="#modal" data-url="{{path('course_set_expiryday', {courseId:course.id, userId:user.id})}}">{{'增加有效期'|trans}}</a></li>
        {% endif %}

        {% if app.user.isAdmin() or  app.user.isTeacher() and  isTeacherAuthManageStudent == 1 %}
          <li><a class="student-remove" href="javascript:;" data-url="{{path('course_manage_student_remove', {courseId:course.id, userId:user.id})}}" data-user="{{ default.user_name|default('学员'|trans) }}">{{'移除'|trans}}</a></li>
        {% endif %}
      </ul>
    </div>
  </td>
</tr>